function drawCube (a)
% Create X.
X = zeros(8,3);

X([5:8,11,12,15,16,18,20,22,24]) = 1; % Corners.

X(5,:) = a(1,:);
X(3,:) = a(2,:);
X(2,:) = a(3,:);

X(4,:) = a(2,:)+a(3,:);
X(6,:) = a(1,:)+a(3,:);
X(7,:) = a(1,:)+a(2,:);
X(8,:) = a(1,:)+a(2,:)+a(3,:);


% Visualize X.
cla reset; hold on
d = [1 2 4 3 1 5 6 8 7 5 6 2 4 8 7 3];
plot3(X(d,1),X(d,2),X(d,3),'b:');
plot3(X(:,1),X(:,2),X(:,3),'b.','markersize',20);
t = text(X(:,1),X(:,2),X(:,3), num2str((1:8)'));
set(t,'VerticalAlignment','bottom','FontWeight','bold', 'FontSize',12);

view(3);
axis equal tight  vis3d; 
camorbit(10,0);
rotate3d on
end